package com.haoyeteng.sxbd.modular.business.controller;

import com.haoyeteng.sxbd.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.haoyeteng.sxbd.core.base.model.ResponseResult;
import com.haoyeteng.sxbd.core.common.annotion.Permission;
import java.util.List;
import java.util.Map;
import com.haoyeteng.sxbd.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.haoyeteng.sxbd.modular.business.model.ZbzhFile;
import com.haoyeteng.sxbd.modular.business.service.IZbzhFileService;

/**
 * 坐标转换文件表控制器
 *
 * @author haoyeteng
 * @Date 2019-10-27 08:38:39
 */
@Controller
@RequestMapping("/zbzhFile")
public class ZbzhFileController extends BaseController {

    private String PREFIX = "/business/zbzhFile/";

    @Autowired
    private IZbzhFileService zbzhFileService;

    /**
     * 跳转到坐标转换文件表首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "zbzhFile.html";
    }

    /**
     * 跳转到添加坐标转换文件表
     */
    @RequestMapping("/zbzhFile_add")
    public String zbzhFileAdd() {
        return PREFIX + "zbzhFile_add.html";
    }

    /**
     * 跳转到修改坐标转换文件表
     */
    @RequestMapping("/zbzhFile_update/{zbzhFileId}")
    public String zbzhFileUpdate(@PathVariable Integer zbzhFileId, Model model) {
        ZbzhFile zbzhFile = zbzhFileService.selectById(zbzhFileId);
        model.addAttribute("item",zbzhFile);
        LogObjectHolder.me().set(zbzhFile);
        return PREFIX + "zbzhFile_edit.html";
    }

    /**
     * 获取坐标转换文件表列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    @Permission
    public ResponseResult<Object> list(String condition) {
    	ResponseResult<Object> result = new ResponseResult<Object>();
        result.setData(0);
 		result.setCount(0);
     	result.setCode(SUCCESS_TIP.getCode());
     	result.setMsg(SUCCESS_TIP.getMessage());
 		return result;
    }

    /**
     * 新增坐标转换文件表
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    @Permission
    public Object add(ZbzhFile zbzhFile) {
        zbzhFileService.insert(zbzhFile);
        return SUCCESS_TIP;
    }

    /**
     * 删除坐标转换文件表
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    @Permission
    public Object delete(@RequestParam Integer zbzhFileId) {
        zbzhFileService.deleteById(zbzhFileId);
        return SUCCESS_TIP;
    }

    /**
     * 修改坐标转换文件表
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    @Permission
    public Object update(ZbzhFile zbzhFile) {
        zbzhFileService.updateById(zbzhFile);
        return SUCCESS_TIP;
    }

    /**
     * 坐标转换文件表详情
     */
    @RequestMapping(value = "/detail/{zbzhFileId}")
    @ResponseBody
    public Object detail(@PathVariable("zbzhFileId") Integer zbzhFileId) {
        return zbzhFileService.selectById(zbzhFileId);
    }
}
